home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Source / Libraries / glut / glut_winmisc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  2.3 KB  |  120 lines  |  [TEXT/CWIE]

  1. /* Copyright (c) Mark J. Kilgard, 1994. */
  2.  
  3. /* This program is freely distributable without licensing fees 
  4.    and is provided without guarantee or warrantee expressed or 
  5.    implied. This program is -not- in the public domain. */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <assert.h>
  11.  
  12. #include "glut.h"
  13. #include "glutint.h"
  14.  
  15. void __glutCToStr255(const char *cs, Str255 ps)
  16. {
  17.     int i = 255;
  18.     *ps++ = strlen(cs);
  19.     while(*cs && i--) *ps++ = *cs++;
  20. }
  21.  
  22. /* CENTRY */
  23. void glutSetWindowTitle(const char *title)
  24. {
  25.     Str255 ps;
  26.     
  27.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  28.     {
  29.         __glutWarning("glutSetWindowTitle: no active window");
  30.         return;
  31.     }
  32.     
  33.     __glutCToStr255(title, ps);
  34.     
  35.     SetWTitle((GrafPort *) __glutCurrentWindow->win, ps);
  36. }
  37.  
  38. void glutSetIconTitle(const char *title)
  39. {
  40. }
  41.  
  42. void glutPositionWindow(int x, int y)
  43. {
  44.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  45.     {
  46.         __glutWarning("glutPositionWindow: no active window");
  47.         return;
  48.     }
  49.     
  50.     MoveWindow((GrafPort *) __glutCurrentWindow->win, x, y, GL_FALSE);
  51. }
  52.  
  53. void glutReshapeWindow(int w, int h)
  54. {
  55.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  56.     {
  57.         __glutWarning("glutReshapeWindow: no active window");
  58.         return;
  59.     }
  60.     
  61.     if(w <= 0 || h <= 0)
  62.     {
  63.         __glutWarning("glutReshapeWindow: non-positive width or height not allowed");
  64.         return;
  65.     }
  66.     
  67.     SizeWindow((GrafPort *) __glutCurrentWindow->win, w, h, GL_FALSE);
  68.     __glutWindowReshape(__glutCurrentWindow, w, h);
  69. }
  70.  
  71. void glutPopWindow(void)
  72. {
  73.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  74.     {
  75.         __glutWarning("glutPopWindow: no active window");
  76.         return;
  77.     }
  78.  
  79.     BringToFront((GrafPort *) __glutCurrentWindow->win);
  80. }
  81.  
  82. void glutPushWindow(void)
  83. {
  84.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  85.     {
  86.         __glutWarning("glutPushWindow: no active window");
  87.         return;
  88.     }
  89.  
  90.     SendBehind((GrafPort *) __glutCurrentWindow->win, 0);
  91. }
  92.  
  93. void glutIconifyWindow(void)
  94. {
  95. }
  96.  
  97. void glutShowWindow(void)
  98. {
  99.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  100.     {
  101.         __glutWarning("glutShowWindow: no active window");
  102.         return;
  103.     }
  104.     
  105.     ShowWindow((GrafPort *) __glutCurrentWindow->win);
  106. }
  107.  
  108. void glutHideWindow(void)
  109. {
  110.     if(!__glutCurrentWindow || !__glutCurrentWindow->win)
  111.     {
  112.         __glutWarning("glutHideWindow: no active window");
  113.         return;
  114.     }
  115.     
  116.     HideWindow((GrafPort *) __glutCurrentWindow->win);
  117. }
  118.  
  119. /* ENDCENTRY */
  120.